/**
 * @author xiufu.wang
 */
import BaseRequestActuator from './BaseRequestActuator'
import axiosUtils from 'axios/lib/utils'
import { stringify } from 'qs';

export default class PostFormRequestActuator extends BaseRequestActuator {
  constructor(config) {
    super(config, 'post', 'data')
  }
  data(data){
    data = axiosUtils.isFormData(data) ? data : stringify((data || {}), { arrayFormat: 'repeat', strictNullHandling: true })
    return super.data(data) 
  }

  done(url, data) {
    data = axiosUtils.isFormData(data) ? data : stringify((data || {}), { arrayFormat: 'repeat', strictNullHandling: true })
    return super.done(url, data)
  }
}